function zonghe(id, page,Array) {
  let main = document.querySelector(id)
  let tbody = main.querySelector('tbody')
  let oul = main.querySelector(".page ul")
  let nextPage = main.querySelector('.nextPage')
  let beforePage = main.querySelector('.beforePage')
  let lastPage = main.querySelector('.lastPage')
  // 1.导入数据
  function daoru(arr) {
    if (typeof arr === "undefined") {
      arr = Array.slice();
      arr.length = page
    }
    tbody.innerHTML = ''
    arr.forEach(function (item) {
      tbody.insertAdjacentHTML('beforeEnd', `<tr>
      <td>${item.id}</td>
      <td>${item.planName}</td>
      <td>${item.planStartTime}</td>
      <td>${item.planEndTime}</td>
      <td>${item.now}</td>
      <td>${item.planRequire}</td>
      <td><div class="btn-group ">
      <button type="button" class="btn btn-sm btn-default amend">
      <span class="glyphicon glyphicon-pencil" > </span>
      </button>
      <button type="button" class="delet btn btn-sm btn-default">
      <span class="glyphicon glyphicon-trash" > </span>
      </button>
      <button type="button" class="sure btn btn-sm btn-default" style="display:none;">
      <span class="glyphicon glyphicon-ok" > </span>
      </button>
      <button type="button" class="back btn btn-sm btn-default" style="display:none;">
      <span class="glyphicon glyphicon-remove" > </span>
      </button>
      </div></td>
      </tr>`)
    })
  }

  // 2 分页功能
  let a = 1
  function changePage(x, y) {
    let item = Array.slice((x) * page, +(y) * page)
    daoru(item)
  }
  for (let index = 0; index < Array.length / page; index++) {
    let oSpan = document.createElement('li');
    oSpan.classList = 'btn btn-info'
    oSpan.innerHTML = index + 1;
    oSpan.onclick = function () {
      changePage(this.innerHTML - 1, this.innerHTML)
      a = this.innerHTML
    }
    oul.appendChild(oSpan)
  }
  nextPage.onclick = function () {
    if (a == Math.ceil(Array.length / page)) {
      return 0
    }
    changePage(a, a + 1)
    a++
  }
  beforePage.onclick = function () {
    if (a == 1) {
      return 0
    }
    changePage(a - 2, a - 1)
    a--
  }
  lastPage.onclick = function () {
    if (lastPage.textContent == '最后一页') {
      lastPage.textContent = '第一页'
      changePage(Math.ceil(Array.length / page) - 1, Math.ceil(Array.length / page))
      a = 4
    } else {
      lastPage.textContent = '最后一页'
      changePage(0, 1)
      a = 1
    }
  }
}
zonghe(".showone", 6,news)
this.sel=this.main.querySelector('select')
this.sel.onclick=()=>{
    this.main.querySelector(".page ul").innerHTML=''
    let index = this.sel.selectedIndex;
    this.fenye(this.sel.options[index].value) 
}